package com.demo.juc.async;

public class TaskExecutor implements Runnable{

    private TaskCallable<TaskResult> taskCallable;
    private String taskParam;

    public TaskExecutor(TaskCallable<TaskResult> taskCallable, String taskParam) {
        this.taskCallable = taskCallable;
        this.taskParam = taskParam;
    }

    @Override
    public void run() {

        //TODO 一系列业务逻辑,将结果数据封装成TaskResult对象并返回
        TaskResult result = new TaskResult();
        result.setStatus("1");
        result.setMassage(this.taskParam);
        result.setResult("异步回调成功");
        taskCallable.callable(result);
    }
}
